﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace TRON_TheGrid
{
    class Grille: ObjetFixe
    {
        private List<Mur> listMurs;
        

        public Grille(Game game,Texture2D texture, Vector2 position, Vector2 size):base(game,texture,position,size)
        {
            listMurs = new List<Mur>();
        }

        /// <summary>
        /// Allows the game component to perform any initialization it needs to before starting
        /// to run.  This is where it can query for any required services and load content.
        /// </summary>
        public override void Initialize()
        {
            // TODO: Add your initialization code here

            base.Initialize();
        }

        /// <summary>
        /// Allows the game component to update itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        public override void Update(GameTime gameTime)
        {
            listMurs.RemoveAll(MurMort);
            base.Update(gameTime);
        }
        public override void Draw(GameTime gameTime)
        {
            
            base.Draw(gameTime);
        }

        private bool MurMort(Mur unMur)
        {
            if(unMur.DureeVie<=0)
            {
                return true;
            }
            else{
                return false;
            }
        }

        public void NettoieGrid()
        {
            listMurs.Clear();
        }
    }
}
